{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5b5874fd-5d63-4c57-96ff-f85db09dee8b",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/ugly-number\n",
    "\n",
    "\n",
    "Runtime: 0 ms, faster than 100.00% of C++ online submissions for Ugly Number.\n",
    "Memory Usage: 5.8 MB, less than 83.76% of C++ online submissions for Ugly Number.\n",
    "\n",
    "\n",
    "```c++\n",
    "#include<bits/stdc++.h> \n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    vector<float> prime_factors {1.0, 2.0, 3.0, 5.0};\n",
    "\n",
    "    bool is_int(long double n) {\n",
    "        if (abs(n - (round(n))) < 0.000000001) {\n",
    "            return true;\n",
    "        }\n",
    "        return false;\n",
    "    }\n",
    "\n",
    "    bool divition(long double n) {\n",
    "        long double value = roundl(n);\n",
    "\n",
    "        if (value < 1) {\n",
    "            return false;\n",
    "        }\n",
    "\n",
    "        if (value != n) {\n",
    "            return false;\n",
    "        }\n",
    "\n",
    "        float new_value = roundf((float)n);\n",
    "\n",
    "        if (find(prime_factors.begin(), prime_factors.end(), new_value) != prime_factors.end()) {\n",
    "            return true;\n",
    "        } else {\n",
    "            return (divition(n / 2) || divition(n/3)) || (divition(n/5));\n",
    "        }\n",
    "    }\n",
    "\n",
    "    bool isUgly(int n) {\n",
    "        //6:40\n",
    "        return divition(n);\n",
    "        //6:51\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cf489b48-ade3-4afd-9fd6-eef9c7f7538e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
